import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const detail = (id) => {
  return request({
    url: `/api/mes-warehouse/rule-scheme/detail?id=${id}`,
    method: 'get'
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/update',
    method: 'post',
    data: row
  });
};

export const checkRepeatScheme = (row) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/check/name',
    method: 'post',
    params: { ...row }
  });
};

export const del = (data) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/remove',
    method: 'post',
    data: data
  });
};

export const checkIsUse = (row) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/check/before/delete',
    method: 'post',
    data: row
  });
};

export const checkRepeatIsDefault = (row) => {
  return request({
    url: '/api/mes-warehouse/rule-scheme/check/default/rule',
    method: 'post',
    params: { ...row }
  });
};
